#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;


long long a[305][305];
char s[305];
int mod = 1000000000;

long long func(int st, int ed)
{
	if(a[st][ed] != -1)
		return a[st][ed];
	if(st > ed)
		return 0;
	if(st == ed)
		return 1;
	if(s[st] != s[ed])
		return 0;

	a[st][ed] = func(st + 1, ed - 1);
	for(int i = st+1; i < ed; i++)
	{
		if(s[st] == s[i])
			a[st][ed] = (a[st][ed] + func(st + 1, i-1) * func(i, ed)) % mod;
	}
	return a[st][ed];
}

int main()
{
	scanf("%s", s);
	memset(a, -1, sizeof(a));
	int n = strlen(s);

	long long res = func(0, n-1);

	printf("%lld\n", res);
	
	return 0;
}